{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Treebank</th>\n",
       "      <th>Encoding</th>\n",
       "      <th>Language Model</th>\n",
       "      <th>In training data</th>\n",
       "      <th>Random</th>\n",
       "      <th>Task</th>\n",
       "      <th>UAS</th>\n",
       "      <th>LAS</th>\n",
       "      <th>CLAS</th>\n",
       "      <th>MLAS</th>\n",
       "      <th>BLEX</th>\n",
       "      <th>POS</th>\n",
       "      <th>1-deptag</th>\n",
       "      <th>Arc</th>\n",
       "      <th>1-plane</th>\n",
       "      <th>2-plane</th>\n",
       "      <th>Deprel</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>UD_Guajajara-TuDeT</td>\n",
       "      <td>rel-pos</td>\n",
       "      <td>bert-base-multilingual-cased</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>single</td>\n",
       "      <td>47.06</td>\n",
       "      <td>23.53</td>\n",
       "      <td>15.65</td>\n",
       "      <td>1.17</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64.05</td>\n",
       "      <td>45.88</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>UD_Guajajara-TuDeT</td>\n",
       "      <td>rel-pos</td>\n",
       "      <td>bert-base-multilingual-cased</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>multi</td>\n",
       "      <td>45.71</td>\n",
       "      <td>29.58</td>\n",
       "      <td>25.06</td>\n",
       "      <td>2.63</td>\n",
       "      <td>0.0</td>\n",
       "      <td>64.18</td>\n",
       "      <td>NaN</td>\n",
       "      <td>60.92</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>60.92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>UD_Guajajara-TuDeT</td>\n",
       "      <td>rel-pos</td>\n",
       "      <td>bert-base-multilingual-cased</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>single</td>\n",
       "      <td>47.73</td>\n",
       "      <td>23.87</td>\n",
       "      <td>15.32</td>\n",
       "      <td>1.58</td>\n",
       "      <td>0.0</td>\n",
       "      <td>65.23</td>\n",
       "      <td>44.58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>UD_Guajajara-TuDeT</td>\n",
       "      <td>rel-pos</td>\n",
       "      <td>bert-base-multilingual-cased</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>multi</td>\n",
       "      <td>42.02</td>\n",
       "      <td>24.87</td>\n",
       "      <td>22.17</td>\n",
       "      <td>1.93</td>\n",
       "      <td>0.0</td>\n",
       "      <td>63.92</td>\n",
       "      <td>NaN</td>\n",
       "      <td>55.95</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>61.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>UD_Guajajara-TuDeT</td>\n",
       "      <td>rel-pos</td>\n",
       "      <td>xlm-roberta-base</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>single</td>\n",
       "      <td>47.39</td>\n",
       "      <td>25.04</td>\n",
       "      <td>15.60</td>\n",
       "      <td>1.15</td>\n",
       "      <td>0.0</td>\n",
       "      <td>65.10</td>\n",
       "      <td>44.05</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>390</th>\n",
       "      <td>UD_English-EWT</td>\n",
       "      <td>rel-pos</td>\n",
       "      <td>bert-base-cased</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>multi</td>\n",
       "      <td>67.42</td>\n",
       "      <td>60.35</td>\n",
       "      <td>55.96</td>\n",
       "      <td>6.48</td>\n",
       "      <td>0.0</td>\n",
       "      <td>95.10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>68.48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>85.38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>391</th>\n",
       "      <td>UD_English-EWT</td>\n",
       "      <td>relative</td>\n",
       "      <td>bert-base-cased</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>single</td>\n",
       "      <td>53.58</td>\n",
       "      <td>49.14</td>\n",
       "      <td>48.26</td>\n",
       "      <td>5.12</td>\n",
       "      <td>0.0</td>\n",
       "      <td>95.09</td>\n",
       "      <td>57.44</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>392</th>\n",
       "      <td>UD_English-EWT</td>\n",
       "      <td>relative</td>\n",
       "      <td>bert-base-cased</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>multi</td>\n",
       "      <td>47.45</td>\n",
       "      <td>42.37</td>\n",
       "      <td>41.20</td>\n",
       "      <td>3.99</td>\n",
       "      <td>0.0</td>\n",
       "      <td>95.14</td>\n",
       "      <td>NaN</td>\n",
       "      <td>54.90</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>85.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393</th>\n",
       "      <td>modelo finetuneado</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>394</th>\n",
       "      <td>UD_Ligurian-GLT</td>\n",
       "      <td>2-planar-brackets-greedy</td>\n",
       "      <td>dbmdz/bert-base-italian-cased</td>\n",
       "      <td>1</td>\n",
       "      <td>False</td>\n",
       "      <td>multi</td>\n",
       "      <td>67.80</td>\n",
       "      <td>59.79</td>\n",
       "      <td>50.53</td>\n",
       "      <td>10.34</td>\n",
       "      <td>0.0</td>\n",
       "      <td>91.95</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>71.24</td>\n",
       "      <td>100.0</td>\n",
       "      <td>82.59</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>395 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "               Treebank                  Encoding  \\\n",
       "0    UD_Guajajara-TuDeT                   rel-pos   \n",
       "1    UD_Guajajara-TuDeT                   rel-pos   \n",
       "2    UD_Guajajara-TuDeT                   rel-pos   \n",
       "3    UD_Guajajara-TuDeT                   rel-pos   \n",
       "4    UD_Guajajara-TuDeT                   rel-pos   \n",
       "..                  ...                       ...   \n",
       "390      UD_English-EWT                   rel-pos   \n",
       "391      UD_English-EWT                  relative   \n",
       "392      UD_English-EWT                  relative   \n",
       "393  modelo finetuneado                       NaN   \n",
       "394     UD_Ligurian-GLT  2-planar-brackets-greedy   \n",
       "\n",
       "                    Language Model In training data Random    Task    UAS  \\\n",
       "0     bert-base-multilingual-cased            False  False  single  47.06   \n",
       "1     bert-base-multilingual-cased            False   True   multi  45.71   \n",
       "2     bert-base-multilingual-cased            False   True  single  47.73   \n",
       "3     bert-base-multilingual-cased            False  False   multi  42.02   \n",
       "4                 xlm-roberta-base            False   True  single  47.39   \n",
       "..                             ...              ...    ...     ...    ...   \n",
       "390                bert-base-cased             True  False   multi  67.42   \n",
       "391                bert-base-cased             True  False  single  53.58   \n",
       "392                bert-base-cased             True  False   multi  47.45   \n",
       "393                            NaN              NaN    NaN     NaN    NaN   \n",
       "394  dbmdz/bert-base-italian-cased                1  False   multi  67.80   \n",
       "\n",
       "       LAS   CLAS   MLAS  BLEX    POS  1-deptag    Arc  1-plane  2-plane  \\\n",
       "0    23.53  15.65   1.17   0.0  64.05     45.88    NaN      NaN      NaN   \n",
       "1    29.58  25.06   2.63   0.0  64.18       NaN  60.92      NaN      NaN   \n",
       "2    23.87  15.32   1.58   0.0  65.23     44.58    NaN      NaN      NaN   \n",
       "3    24.87  22.17   1.93   0.0  63.92       NaN  55.95      NaN      NaN   \n",
       "4    25.04  15.60   1.15   0.0  65.10     44.05    NaN      NaN      NaN   \n",
       "..     ...    ...    ...   ...    ...       ...    ...      ...      ...   \n",
       "390  60.35  55.96   6.48   0.0  95.10       NaN  68.48      NaN      NaN   \n",
       "391  49.14  48.26   5.12   0.0  95.09     57.44    NaN      NaN      NaN   \n",
       "392  42.37  41.20   3.99   0.0  95.14       NaN  54.90      NaN      NaN   \n",
       "393    NaN    NaN    NaN   NaN    NaN       NaN    NaN      NaN      NaN   \n",
       "394  59.79  50.53  10.34   0.0  91.95       NaN    NaN    71.24    100.0   \n",
       "\n",
       "     Deprel  \n",
       "0       NaN  \n",
       "1     60.92  \n",
       "2       NaN  \n",
       "3     61.83  \n",
       "4       NaN  \n",
       "..      ...  \n",
       "390   85.38  \n",
       "391     NaN  \n",
       "392   85.37  \n",
       "393     NaN  \n",
       "394   82.59  \n",
       "\n",
       "[395 rows x 17 columns]"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# Read in the data\n",
    "df = pd.read_csv('scores.csv')\n",
    "\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sklearn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/alberto/anaconda3/envs/ml_probing/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>In training data</th>\n",
       "      <th>UAS</th>\n",
       "      <th>LAS</th>\n",
       "      <th>CLAS</th>\n",
       "      <th>MLAS</th>\n",
       "      <th>POS</th>\n",
       "      <th>Arc</th>\n",
       "      <th>Deprel</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Treebank</th>\n",
       "      <th>Random</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Welsh-CCG</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>45.99</td>\n",
       "      <td>24.35</td>\n",
       "      <td>15.08</td>\n",
       "      <td>0.50</td>\n",
       "      <td>63.55</td>\n",
       "      <td>54.14</td>\n",
       "      <td>48.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>56.18</td>\n",
       "      <td>32.13</td>\n",
       "      <td>19.74</td>\n",
       "      <td>0.25</td>\n",
       "      <td>67.33</td>\n",
       "      <td>54.18</td>\n",
       "      <td>51.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Vietnamese-VTB</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>23.89</td>\n",
       "      <td>13.87</td>\n",
       "      <td>10.01</td>\n",
       "      <td>4.84</td>\n",
       "      <td>66.12</td>\n",
       "      <td>41.39</td>\n",
       "      <td>49.40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>39.38</td>\n",
       "      <td>27.48</td>\n",
       "      <td>25.58</td>\n",
       "      <td>16.34</td>\n",
       "      <td>74.64</td>\n",
       "      <td>49.15</td>\n",
       "      <td>59.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Turkish-BOUN</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>27.95</td>\n",
       "      <td>15.67</td>\n",
       "      <td>9.84</td>\n",
       "      <td>1.59</td>\n",
       "      <td>66.03</td>\n",
       "      <td>44.16</td>\n",
       "      <td>52.86</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>56.26</td>\n",
       "      <td>45.56</td>\n",
       "      <td>42.59</td>\n",
       "      <td>5.56</td>\n",
       "      <td>86.07</td>\n",
       "      <td>57.01</td>\n",
       "      <td>74.40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Skolt_Sami-Giellagas</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>29.28</td>\n",
       "      <td>8.23</td>\n",
       "      <td>8.06</td>\n",
       "      <td>0.00</td>\n",
       "      <td>48.43</td>\n",
       "      <td>40.42</td>\n",
       "      <td>37.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>6.75</td>\n",
       "      <td>3.10</td>\n",
       "      <td>2.76</td>\n",
       "      <td>0.00</td>\n",
       "      <td>38.56</td>\n",
       "      <td>15.21</td>\n",
       "      <td>31.13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Ligurian-GLT</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>18.38</td>\n",
       "      <td>10.03</td>\n",
       "      <td>5.62</td>\n",
       "      <td>1.12</td>\n",
       "      <td>50.26</td>\n",
       "      <td>34.17</td>\n",
       "      <td>42.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>24.57</td>\n",
       "      <td>3.17</td>\n",
       "      <td>0.83</td>\n",
       "      <td>0.00</td>\n",
       "      <td>39.05</td>\n",
       "      <td>25.59</td>\n",
       "      <td>12.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Kiche-IU</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>47.12</td>\n",
       "      <td>34.75</td>\n",
       "      <td>22.85</td>\n",
       "      <td>4.16</td>\n",
       "      <td>73.49</td>\n",
       "      <td>63.82</td>\n",
       "      <td>65.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>45.68</td>\n",
       "      <td>27.75</td>\n",
       "      <td>15.18</td>\n",
       "      <td>0.97</td>\n",
       "      <td>64.94</td>\n",
       "      <td>58.30</td>\n",
       "      <td>56.54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Guajajara-TuDeT</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>45.71</td>\n",
       "      <td>28.91</td>\n",
       "      <td>25.16</td>\n",
       "      <td>2.29</td>\n",
       "      <td>66.27</td>\n",
       "      <td>60.00</td>\n",
       "      <td>58.82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>40.17</td>\n",
       "      <td>19.66</td>\n",
       "      <td>18.05</td>\n",
       "      <td>1.43</td>\n",
       "      <td>57.52</td>\n",
       "      <td>42.35</td>\n",
       "      <td>41.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Bulgarian-BTB</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>30.24</td>\n",
       "      <td>21.60</td>\n",
       "      <td>11.72</td>\n",
       "      <td>0.16</td>\n",
       "      <td>70.71</td>\n",
       "      <td>48.76</td>\n",
       "      <td>61.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>69.63</td>\n",
       "      <td>59.06</td>\n",
       "      <td>53.00</td>\n",
       "      <td>0.48</td>\n",
       "      <td>96.70</td>\n",
       "      <td>69.51</td>\n",
       "      <td>80.80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Bhojpuri-BHTB</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>17.41</td>\n",
       "      <td>11.98</td>\n",
       "      <td>5.21</td>\n",
       "      <td>0.14</td>\n",
       "      <td>51.20</td>\n",
       "      <td>39.10</td>\n",
       "      <td>45.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>31.79</td>\n",
       "      <td>4.85</td>\n",
       "      <td>3.73</td>\n",
       "      <td>0.12</td>\n",
       "      <td>41.25</td>\n",
       "      <td>26.91</td>\n",
       "      <td>27.87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Basque-BDT</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>25.06</td>\n",
       "      <td>16.15</td>\n",
       "      <td>12.12</td>\n",
       "      <td>0.95</td>\n",
       "      <td>65.56</td>\n",
       "      <td>45.30</td>\n",
       "      <td>55.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>54.78</td>\n",
       "      <td>43.29</td>\n",
       "      <td>40.70</td>\n",
       "      <td>5.53</td>\n",
       "      <td>85.74</td>\n",
       "      <td>59.35</td>\n",
       "      <td>73.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Armenian-ArmTDP</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>22.94</td>\n",
       "      <td>11.98</td>\n",
       "      <td>9.03</td>\n",
       "      <td>0.25</td>\n",
       "      <td>62.44</td>\n",
       "      <td>40.56</td>\n",
       "      <td>51.26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>51.61</td>\n",
       "      <td>38.08</td>\n",
       "      <td>31.58</td>\n",
       "      <td>1.80</td>\n",
       "      <td>78.92</td>\n",
       "      <td>51.87</td>\n",
       "      <td>67.70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Ancient_Greek-Perseus</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>25.90</td>\n",
       "      <td>16.25</td>\n",
       "      <td>7.94</td>\n",
       "      <td>0.96</td>\n",
       "      <td>63.29</td>\n",
       "      <td>39.18</td>\n",
       "      <td>53.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>41.37</td>\n",
       "      <td>28.46</td>\n",
       "      <td>20.23</td>\n",
       "      <td>2.21</td>\n",
       "      <td>78.34</td>\n",
       "      <td>47.40</td>\n",
       "      <td>65.26</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                 In training data    UAS    LAS   CLAS   MLAS  \\\n",
       "Treebank                 Random                                                 \n",
       "UD_Welsh-CCG             True                True  45.99  24.35  15.08   0.50   \n",
       "                         False               True  56.18  32.13  19.74   0.25   \n",
       "UD_Vietnamese-VTB        True                True  23.89  13.87  10.01   4.84   \n",
       "                         False               True  39.38  27.48  25.58  16.34   \n",
       "UD_Turkish-BOUN          True                True  27.95  15.67   9.84   1.59   \n",
       "                         False               True  56.26  45.56  42.59   5.56   \n",
       "UD_Skolt_Sami-Giellagas  True               False  29.28   8.23   8.06   0.00   \n",
       "                         False              False   6.75   3.10   2.76   0.00   \n",
       "UD_Ligurian-GLT          True               False  18.38  10.03   5.62   1.12   \n",
       "                         False              False  24.57   3.17   0.83   0.00   \n",
       "UD_Kiche-IU              True               False  47.12  34.75  22.85   4.16   \n",
       "                         False              False  45.68  27.75  15.18   0.97   \n",
       "UD_Guajajara-TuDeT       True               False  45.71  28.91  25.16   2.29   \n",
       "                         False              False  40.17  19.66  18.05   1.43   \n",
       "UD_Bulgarian-BTB         True                True  30.24  21.60  11.72   0.16   \n",
       "                         False               True  69.63  59.06  53.00   0.48   \n",
       "UD_Bhojpuri-BHTB         True               False  17.41  11.98   5.21   0.14   \n",
       "                         False              False  31.79   4.85   3.73   0.12   \n",
       "UD_Basque-BDT            True                True  25.06  16.15  12.12   0.95   \n",
       "                         False               True  54.78  43.29  40.70   5.53   \n",
       "UD_Armenian-ArmTDP       True                True  22.94  11.98   9.03   0.25   \n",
       "                         False               True  51.61  38.08  31.58   1.80   \n",
       "UD_Ancient_Greek-Perseus True               False  25.90  16.25   7.94   0.96   \n",
       "                         False              False  41.37  28.46  20.23   2.21   \n",
       "\n",
       "                                   POS    Arc  Deprel  \n",
       "Treebank                 Random                        \n",
       "UD_Welsh-CCG             True    63.55  54.14   48.29  \n",
       "                         False   67.33  54.18   51.96  \n",
       "UD_Vietnamese-VTB        True    66.12  41.39   49.40  \n",
       "                         False   74.64  49.15   59.43  \n",
       "UD_Turkish-BOUN          True    66.03  44.16   52.86  \n",
       "                         False   86.07  57.01   74.40  \n",
       "UD_Skolt_Sami-Giellagas  True    48.43  40.42   37.75  \n",
       "                         False   38.56  15.21   31.13  \n",
       "UD_Ligurian-GLT          True    50.26  34.17   42.04  \n",
       "                         False   39.05  25.59   12.01  \n",
       "UD_Kiche-IU              True    73.49  63.82   65.25  \n",
       "                         False   64.94  58.30   56.54  \n",
       "UD_Guajajara-TuDeT       True    66.27  60.00   58.82  \n",
       "                         False   57.52  42.35   41.44  \n",
       "UD_Bulgarian-BTB         True    70.71  48.76   61.33  \n",
       "                         False   96.70  69.51   80.80  \n",
       "UD_Bhojpuri-BHTB         True    51.20  39.10   45.22  \n",
       "                         False   41.25  26.91   27.87  \n",
       "UD_Basque-BDT            True    65.56  45.30   55.34  \n",
       "                         False   85.74  59.35   73.16  \n",
       "UD_Armenian-ArmTDP       True    62.44  40.56   51.26  \n",
       "                         False   78.92  51.87   67.70  \n",
       "UD_Ancient_Greek-Perseus True    63.29  39.18   53.98  \n",
       "                         False   78.34  47.40   65.26  "
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rel_pos = df[df['Encoding'] == 'rel-pos'][df['Language Model'] == 'xlm-roberta-base'][df['Task'] == 'multi']\n",
    "rel_pos = rel_pos.drop(['Language Model', 'Encoding', 'Task', 'BLEX'], axis=1).dropna(axis=1).sort_values(['Treebank', 'Random'], ascending=False)\n",
    "\n",
    "rel_pos = rel_pos.set_index(['Treebank', 'Random'])#.groupby(level=0).diff().dropna().reset_index().drop('Random', axis=1)\n",
    "\n",
    "#rel_pos['In training data'] = [True, True, True, False, False, False, False, True, False, True, True, False]\n",
    "\n",
    "rel_pos"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/alberto/anaconda3/envs/ml_probing/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>In training data</th>\n",
       "      <th>UAS</th>\n",
       "      <th>LAS</th>\n",
       "      <th>CLAS</th>\n",
       "      <th>MLAS</th>\n",
       "      <th>POS</th>\n",
       "      <th>1-deptag</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Treebank</th>\n",
       "      <th>Random</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Welsh-CCG</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>12.49</td>\n",
       "      <td>6.20</td>\n",
       "      <td>7.56</td>\n",
       "      <td>0.75</td>\n",
       "      <td>63.85</td>\n",
       "      <td>19.13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>11.04</td>\n",
       "      <td>4.82</td>\n",
       "      <td>4.03</td>\n",
       "      <td>0.17</td>\n",
       "      <td>66.39</td>\n",
       "      <td>17.41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Vietnamese-VTB</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>9.76</td>\n",
       "      <td>4.42</td>\n",
       "      <td>3.15</td>\n",
       "      <td>1.35</td>\n",
       "      <td>66.26</td>\n",
       "      <td>20.58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>6.97</td>\n",
       "      <td>1.97</td>\n",
       "      <td>1.15</td>\n",
       "      <td>0.77</td>\n",
       "      <td>74.93</td>\n",
       "      <td>18.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Turkish-BOUN</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>7.00</td>\n",
       "      <td>3.36</td>\n",
       "      <td>2.40</td>\n",
       "      <td>0.34</td>\n",
       "      <td>66.08</td>\n",
       "      <td>25.89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>5.86</td>\n",
       "      <td>3.32</td>\n",
       "      <td>2.75</td>\n",
       "      <td>0.63</td>\n",
       "      <td>86.15</td>\n",
       "      <td>25.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Skolt_Sami-Giellagas</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>9.04</td>\n",
       "      <td>2.83</td>\n",
       "      <td>3.75</td>\n",
       "      <td>0.00</td>\n",
       "      <td>46.23</td>\n",
       "      <td>19.63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>5.26</td>\n",
       "      <td>3.51</td>\n",
       "      <td>4.57</td>\n",
       "      <td>0.00</td>\n",
       "      <td>35.42</td>\n",
       "      <td>2.56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Ligurian-GLT</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>5.76</td>\n",
       "      <td>1.39</td>\n",
       "      <td>1.90</td>\n",
       "      <td>0.00</td>\n",
       "      <td>50.13</td>\n",
       "      <td>11.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>2.83</td>\n",
       "      <td>1.30</td>\n",
       "      <td>1.75</td>\n",
       "      <td>0.00</td>\n",
       "      <td>37.95</td>\n",
       "      <td>0.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Kiche-IU</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>32.30</td>\n",
       "      <td>20.55</td>\n",
       "      <td>17.82</td>\n",
       "      <td>1.54</td>\n",
       "      <td>73.21</td>\n",
       "      <td>45.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>26.77</td>\n",
       "      <td>14.82</td>\n",
       "      <td>10.48</td>\n",
       "      <td>0.19</td>\n",
       "      <td>65.47</td>\n",
       "      <td>39.12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Guajajara-TuDeT</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>42.69</td>\n",
       "      <td>17.65</td>\n",
       "      <td>15.26</td>\n",
       "      <td>0.79</td>\n",
       "      <td>63.53</td>\n",
       "      <td>39.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>38.82</td>\n",
       "      <td>14.45</td>\n",
       "      <td>15.87</td>\n",
       "      <td>1.02</td>\n",
       "      <td>33.07</td>\n",
       "      <td>16.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Bulgarian-BTB</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>11.58</td>\n",
       "      <td>6.70</td>\n",
       "      <td>5.07</td>\n",
       "      <td>0.13</td>\n",
       "      <td>70.71</td>\n",
       "      <td>25.60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>13.11</td>\n",
       "      <td>8.13</td>\n",
       "      <td>6.99</td>\n",
       "      <td>0.16</td>\n",
       "      <td>96.65</td>\n",
       "      <td>25.52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Bhojpuri-BHTB</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>4.95</td>\n",
       "      <td>1.54</td>\n",
       "      <td>1.34</td>\n",
       "      <td>0.00</td>\n",
       "      <td>49.90</td>\n",
       "      <td>16.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>1.33</td>\n",
       "      <td>0.27</td>\n",
       "      <td>0.32</td>\n",
       "      <td>0.00</td>\n",
       "      <td>42.50</td>\n",
       "      <td>1.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Basque-BDT</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>8.59</td>\n",
       "      <td>4.04</td>\n",
       "      <td>3.00</td>\n",
       "      <td>0.22</td>\n",
       "      <td>65.60</td>\n",
       "      <td>23.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>7.53</td>\n",
       "      <td>3.81</td>\n",
       "      <td>3.05</td>\n",
       "      <td>0.29</td>\n",
       "      <td>85.89</td>\n",
       "      <td>23.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Armenian-ArmTDP</th>\n",
       "      <th>True</th>\n",
       "      <td>True</td>\n",
       "      <td>7.05</td>\n",
       "      <td>2.88</td>\n",
       "      <td>2.29</td>\n",
       "      <td>0.06</td>\n",
       "      <td>62.67</td>\n",
       "      <td>17.14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>True</td>\n",
       "      <td>5.59</td>\n",
       "      <td>1.94</td>\n",
       "      <td>1.47</td>\n",
       "      <td>0.00</td>\n",
       "      <td>78.98</td>\n",
       "      <td>15.78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">UD_Ancient_Greek-Perseus</th>\n",
       "      <th>True</th>\n",
       "      <td>False</td>\n",
       "      <td>11.20</td>\n",
       "      <td>5.34</td>\n",
       "      <td>3.72</td>\n",
       "      <td>0.57</td>\n",
       "      <td>63.25</td>\n",
       "      <td>22.10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>False</th>\n",
       "      <td>False</td>\n",
       "      <td>11.82</td>\n",
       "      <td>5.62</td>\n",
       "      <td>4.17</td>\n",
       "      <td>0.66</td>\n",
       "      <td>78.43</td>\n",
       "      <td>20.75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                 In training data    UAS    LAS   CLAS  MLAS  \\\n",
       "Treebank                 Random                                                \n",
       "UD_Welsh-CCG             True                True  12.49   6.20   7.56  0.75   \n",
       "                         False               True  11.04   4.82   4.03  0.17   \n",
       "UD_Vietnamese-VTB        True                True   9.76   4.42   3.15  1.35   \n",
       "                         False               True   6.97   1.97   1.15  0.77   \n",
       "UD_Turkish-BOUN          True                True   7.00   3.36   2.40  0.34   \n",
       "                         False               True   5.86   3.32   2.75  0.63   \n",
       "UD_Skolt_Sami-Giellagas  True               False   9.04   2.83   3.75  0.00   \n",
       "                         False              False   5.26   3.51   4.57  0.00   \n",
       "UD_Ligurian-GLT          True               False   5.76   1.39   1.90  0.00   \n",
       "                         False              False   2.83   1.30   1.75  0.00   \n",
       "UD_Kiche-IU              True               False  32.30  20.55  17.82  1.54   \n",
       "                         False              False  26.77  14.82  10.48  0.19   \n",
       "UD_Guajajara-TuDeT       True               False  42.69  17.65  15.26  0.79   \n",
       "                         False              False  38.82  14.45  15.87  1.02   \n",
       "UD_Bulgarian-BTB         True                True  11.58   6.70   5.07  0.13   \n",
       "                         False               True  13.11   8.13   6.99  0.16   \n",
       "UD_Bhojpuri-BHTB         True               False   4.95   1.54   1.34  0.00   \n",
       "                         False              False   1.33   0.27   0.32  0.00   \n",
       "UD_Basque-BDT            True                True   8.59   4.04   3.00  0.22   \n",
       "                         False               True   7.53   3.81   3.05  0.29   \n",
       "UD_Armenian-ArmTDP       True                True   7.05   2.88   2.29  0.06   \n",
       "                         False               True   5.59   1.94   1.47  0.00   \n",
       "UD_Ancient_Greek-Perseus True               False  11.20   5.34   3.72  0.57   \n",
       "                         False              False  11.82   5.62   4.17  0.66   \n",
       "\n",
       "                                   POS  1-deptag  \n",
       "Treebank                 Random                   \n",
       "UD_Welsh-CCG             True    63.85     19.13  \n",
       "                         False   66.39     17.41  \n",
       "UD_Vietnamese-VTB        True    66.26     20.58  \n",
       "                         False   74.93     18.83  \n",
       "UD_Turkish-BOUN          True    66.08     25.89  \n",
       "                         False   86.15     25.10  \n",
       "UD_Skolt_Sami-Giellagas  True    46.23     19.63  \n",
       "                         False   35.42      2.56  \n",
       "UD_Ligurian-GLT          True    50.13     11.48  \n",
       "                         False   37.95      0.88  \n",
       "UD_Kiche-IU              True    73.21     45.33  \n",
       "                         False   65.47     39.12  \n",
       "UD_Guajajara-TuDeT       True    63.53     39.61  \n",
       "                         False   33.07     16.34  \n",
       "UD_Bulgarian-BTB         True    70.71     25.60  \n",
       "                         False   96.65     25.52  \n",
       "UD_Bhojpuri-BHTB         True    49.90     16.49  \n",
       "                         False   42.50      1.24  \n",
       "UD_Basque-BDT            True    65.60     23.20  \n",
       "                         False   85.89     23.06  \n",
       "UD_Armenian-ArmTDP       True    62.67     17.14  \n",
       "                         False   78.98     15.78  \n",
       "UD_Ancient_Greek-Perseus True    63.25     22.10  \n",
       "                         False   78.43     20.75  "
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rel_pos = df[df['Encoding'] == 'absolute'][df['Language Model'] == 'xlm-roberta-base'][df['Task'] == 'single']\n",
    "rel_pos = rel_pos.drop(['Language Model', 'Encoding', 'Task', 'BLEX'], axis=1).dropna(axis=1).sort_values(['Treebank', 'Random'], ascending=False)\n",
    "\n",
    "rel_pos = rel_pos.set_index(['Treebank', 'Random'])#.groupby(level=0).diff().dropna().reset_index().drop('Random', axis=1)\n",
    "\n",
    "#rel_pos['In training data'] = [True, True, True, False, False, False, False, True, False, True, True, False]\n",
    "\n",
    "rel_pos"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "085035040a5f8541f0a11a144df6817fe51afa0926562ddfedc7359bee17119a"
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.13 (default, Mar 29 2022, 02:18:16) \n[GCC 7.5.0]"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
